package com.leo;

import com.almasb.fxgl.app.GameApplication;
import com.almasb.fxgl.app.GameSettings;
import com.almasb.fxgl.dsl.FXGL;
import com.leo.entity.ImageEntityFactory;
import javafx.scene.image.Image;

/**
 * @Author: wangss
 * @CreateTime: 2023-06-05  23:24
 * @Description: TODO
 */
public class ComponentApp extends GameApplication {
    @Override
    protected void initSettings(GameSettings settings) {

    }

    @Override
    protected void onPreInit() {
        // 如果图片资源比较大，可以在这个方法中预加载
        FXGL.getAssetLoader().loadImage("tank/tank.png");
        // 这种方式加载资源不会进行缓存
        Image image = new Image(FXGL.getAssetLoader().getStream("/assets/textures/tank/tank.png"));
    }

    @Override
    protected void initGame() {
        FXGL.getGameWorld().addEntityFactory(new ImageEntityFactory());
        FXGL.spawn("tank");
    }

    public static void main(String[] args) {
        launch(args);
    }
}
